package com.bx.implatform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bx.implatform.entity.primary.Friend;
import com.bx.implatform.entity.secondary.SecondaryUser;
import com.bx.implatform.mapper.secondary.SecondaryUserMapper;
import com.bx.implatform.service.SecondaryUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class SecondaryUserServiceImpl extends ServiceImpl<SecondaryUserMapper, SecondaryUser> implements SecondaryUserService {


    @Override
    public SecondaryUser findUserById(Integer id) {
        return this.getById(id);
    }

    @Override
    public void addUser(SecondaryUser secondaryUser) {
        this.save(secondaryUser);
    }

    @Override
    public SecondaryUser findUserByImId(Long id) {
        QueryWrapper<SecondaryUser> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(SecondaryUser::getImUserId, id);
        return this.getOne(wrapper);
    }

}
